﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace Business.Models
{
    public class KhoiLop
    {
        [Key]
        public int IdKhoiLop { get; set; }
        public int TenKhoiLop { get; set; }
        public int IdTruongHoc { get; set; }
        public int HoatDong { get; set; }
        public int IdNhanVien { get; set; }
        [ForeignKey("IdTruongHoc")] 
        public virtual TruongHoc TruongHoc { get; set; }
        [ForeignKey("IdNhanVien")]
        public virtual QuanTri QuanTri { get; set; }
    }

    public class KhoiLopConfiguration : EntityTypeConfiguration<KhoiLop>
    {

        public KhoiLopConfiguration()
            : base()
        {

            HasKey(d => d.IdKhoiLop);
            Property(d => d.IdKhoiLop).
                HasColumnName("IdKhoiLop").
                HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity).
                IsRequired();
            Property(d => d.IdTruongHoc).HasColumnName("TruongHoc");
            ToTable("KhoiLop", "dbo");
        }

    }
}